package com.banyuan.utils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtils {

    public static Date stringToDate(String str) {

        String pattern = "yyyy-MM-dd";
        Date date = stringToDate(str, pattern);
        return date;
    }


    // String转Date

    public static Date stringToDate(String str,String pattern) {
        SimpleDateFormat sdf = new SimpleDateFormat(pattern);
        Date parse = null;
        try {
             parse = sdf.parse(str);
        } catch (ParseException e) {
            e.printStackTrace();
        }

        return parse;
    }


}
